#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <pthread.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <arpa/inet.h>
#include <sys/socket.h>
#include <dirent.h>
#include <time.h>

#include "bash.h"
#include "pack.h"
#include "mypthread.h"
#include "file.h"

void send_pack2097440(pack *file_r,char *new_value)
{
	int sock = socket(AF_INET,SOCK_DGRAM,0);
	int opt = 1;
	if(setsockopt(sock,SOL_SOCKET,SO_BROADCAST,&opt,sizeof(opt)))
	{
		perror("setsockopt error\n");
	}

	struct sockaddr_in addr;
	addr.sin_family = AF_INET;
	addr.sin_port = htons(2425);
	inet_pton(AF_INET,file_r->IP,&addr.sin_addr.s_addr);

	int len = sizeof(addr);
	char buf[1024];
	int size = 0;
	size = Packfile_2097440(buf,new_value);
	sendto(sock,buf,size,0,(struct sockaddr *)&addr,len);
}